{% extends 'base.html' %}
{% load staticfiles %}

{% block content %}

<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
    <h2>查询</h2>
    <form class="form-horizontal" method="POST" action="/order">
        <div class="form-group">
            <label for="inputEmail3" class="col-sm-2 control-label">顾客姓名</label>
            <div class="col-sm-5">
                <input type="text" class="form-control" name="name" id="inputEmail3">
            </div>
        </div>
        {% csrf_token %}
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-2">
                <button type="submit" class="btn btn-primary">查询</button>
            </div>
        </div>
    </form>
    <h2 class="sub-header">订单列表</h2>
    <div class="table-responsive">
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>#</th>
                    <th>房间号</th>
                    <th>房间类型</th>
                    <th>顾客姓名</th>
                    <th>消费金额</th>
                    <th>入住时间</th>
                    <th>离开时间</th>
                </tr>
            </thead>
            <tbody>
                {% for room_info in rooms%}
                <tr>
                    <td>{{forloop.counter}}</td>
                    <td>{{room_info.room_num}}</td>
                    <td>
                        {{room_info.room_type}}
                    </td>
                    <td>{{room_info.username}}</td>
                    <td>{{room_info.money}}元</td>
                    <td>{{room_info.s_time|date:"Y-m-d"}}</td>
                    <td>{{room_info.e_time|date:"Y-m-d"}}</td>
                </tr>
                {%endfor %}
            </tbody>
        </table>
        <div class="text-center">
            <a class="btn btn-primary" href="/order?page={{page_pre}}">上一页</a>
            <a class="btn btn-primary" href="/order?page={{page_next}}">下一页</a>
        </div>
    </div>
</div>


{% endblock %}